<?php

/**
 * CompraInternacional form base class.
 *
 * @method CompraInternacional getObject() Returns the current form's model object
 *
 * @package    dirsac
 * @subpackage form
 * @author     Miguel Flores
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCompraInternacionalForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'per'                => new sfWidgetFormInputText(),
      'cuenta_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cuenta'), 'add_empty' => false)),
      'moneda_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Moneda'), 'add_empty' => false)),
      'nombre_encargado'   => new sfWidgetFormInputText(),
      'correo_encargado'   => new sfWidgetFormInputText(),
      'anexo_encargado'    => new sfWidgetFormInputText(),
      'proveedor_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ProveedorInternacional'), 'add_empty' => false)),
      'tipo'               => new sfWidgetFormInputText(),
      'estado'             => new sfWidgetFormInputText(),
      'forma_pago'         => new sfWidgetFormChoice(array('choices' => array('Cheque' => 'Cheque', 'Efectivo' => 'Efectivo', 'Tarjeta' => 'Tarjeta'))),
      'plazo_entrega'      => new sfWidgetFormDate(),
      'nombre_contacto'    => new sfWidgetFormInputText(),
      'correo_contacto'    => new sfWidgetFormInputText(),
      'telefono_contacto'  => new sfWidgetFormInputText(),
      'factura'            => new sfWidgetFormInputText(),
      'packing'            => new sfWidgetFormInputText(),
      'cotizacion'         => new sfWidgetFormInputText(),
      'otros'              => new sfWidgetFormInputText(),
      'agencia_de_aduanas' => new sfWidgetFormInputCheckbox(),
      'freight_forwarder'  => new sfWidgetFormInputCheckbox(),
      'con_cargonet'       => new sfWidgetFormInputCheckbox(),
      'total'              => new sfWidgetFormInputText(),
      'observacion'        => new sfWidgetFormTextarea(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'per'                => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'cuenta_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cuenta'))),
      'moneda_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Moneda'))),
      'nombre_encargado'   => new sfValidatorString(array('max_length' => 255)),
      'correo_encargado'   => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'anexo_encargado'    => new sfValidatorInteger(),
      'proveedor_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ProveedorInternacional'))),
      'tipo'               => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'estado'             => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'forma_pago'         => new sfValidatorChoice(array('choices' => array(0 => 'Cheque', 1 => 'Efectivo', 2 => 'Tarjeta'), 'required' => false)),
      'plazo_entrega'      => new sfValidatorDate(array('required' => false)),
      'nombre_contacto'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'correo_contacto'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telefono_contacto'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'factura'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'packing'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'cotizacion'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'otros'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'agencia_de_aduanas' => new sfValidatorBoolean(array('required' => false)),
      'freight_forwarder'  => new sfValidatorBoolean(array('required' => false)),
      'con_cargonet'       => new sfValidatorBoolean(array('required' => false)),
      'total'              => new sfValidatorNumber(),
      'observacion'        => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('compra_internacional[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CompraInternacional';
  }

}
